package com.jxs.easysecurity.http;

import com.jxs.easysecurity.resource.http.UriResource;
import com.jxs.easysecurity.session.Session;

import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @see SecurityValidationFilter
 * @author jiangxingshang
 * @since 16/10/21
 */
public interface SecurityFilterInterceptor {

    /**
     * 请求进入到过滤器时。
     * @return 如果你想自己控制过滤器的走向，请返回false。
     */
    boolean onPreHandle(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Session session);

    /**
     * 从请求uri中匹配到一个{@link UriResource}时。
     * @return 如果你想自己控制过滤器的走向，请返回false。
     */
    boolean onResourceFound(HttpServletRequest request, HttpServletResponse response, FilterChain chain, UriResource resource, Session session);
}
